<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- https://web.nodejs.cn/en-US/docs/Web/HTTP/CSP -->
  <meta http-equiv="Content-Security-Policy"
    content="default-src 'self'; script-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net http://www.keyu.live; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net; font-src 'self' https://cdn.jsdelivr.net">
  <title>可遇AI弹幕工具 - keyu.live</title>
  <!-- Bootstrap CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Bootstrap Icons -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css" rel="stylesheet">
  <style>
    body {
      background: #ffffff;
      min-height: 100vh;
      font-family: 'Microsoft YaHei', sans-serif;
    }

    .main-container {
      background: rgba(255, 255, 255, 0.95);
      border-radius: 20px;
      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
      backdrop-filter: blur(10px);
    }

    .btn-primary {
      background: linear-gradient(45deg, #007bff, #0056b3);
      border: none;
      border-radius: 10px;
      padding: 12px 30px;
      font-weight: 600;
      transition: all 0.3s ease;
    }

    .btn-primary:hover {
      transform: translateY(-2px);
      box-shadow: 0 8px 20px rgba(0, 123, 255, 0.3);
    }

    .form-control {
      border-radius: 10px;
      border: 2px solid #e9ecef;
      padding: 12px 16px;
      transition: all 0.3s ease;
    }

    .form-control:focus {
      border-color: #007bff;
      box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }

    .guide-step {
      background: linear-gradient(45deg, #f8f9fa, #e9ecef);
      border-left: 4px solid #007bff;
      border-radius: 8px;
      transition: all 0.3s ease;
    }

    .guide-step:hover {
      transform: translateX(5px);
      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    .platform-badge {
      background: linear-gradient(45deg, #007bff, #0056b3);
      color: white;
      border-radius: 20px;
      padding: 8px 16px;
      margin: 4px;
      display: inline-block;
      font-weight: 500;
      transition: all 0.3s ease;
    }

    .platform-badge:hover {
      transform: scale(1.05);
      box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    }

    .version-info {
      background: rgba(0, 123, 255, 0.1);
      border-radius: 10px;
      padding: 10px;
      font-size: 0.9em;
      color: #495057;
    }

    .title-gradient {
      background: linear-gradient(45deg, #007bff, #0056b3);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      font-weight: 700;
    }

    .websocket-status,
    .websocket-connections {
      background: linear-gradient(45deg, #f8f9fa, #ffffff);
      border: 2px solid #e9ecef !important;
      transition: all 0.3s ease;
    }

    .websocket-status:hover,
    .websocket-connections:hover {
      border-color: #007bff !important;
      box-shadow: 0 4px 15px rgba(0, 123, 255, 0.1);
    }

    .status-indicator {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      display: inline-block;
      animation: pulse 2s infinite;
    }

    .status-indicator.online {
      background-color: #28a745;
    }

    .status-indicator.offline {
      background-color: #dc3545;
    }

    .connection-count {
      font-size: 1.5em;
      font-weight: 700;
      color: #007bff;
    }

    .current-platform {
      background: linear-gradient(45deg, #f8f9fa, #ffffff);
      border: 2px solid #e9ecef !important;
      transition: all 0.3s ease;
      border-radius: 10px;
    }

    .current-platform:hover {
      border-color: #007bff !important;
      box-shadow: 0 4px 15px rgba(0, 123, 255, 0.1);
    }

    .platform-name {
      font-size: 1.2em;
      font-weight: 600;
      color: #007bff;
    }

    .platform-icon {
      font-size: 1.2em;
    }

    @keyframes pulse {
      0% {
        opacity: 1;
      }

      50% {
        opacity: 0.5;
      }

      100% {
        opacity: 1;
      }
    }

    /* 禁止在编辑框之外选择文本，光标设为默认样式 */
    body {
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      cursor: default;
    }

    /* 允许在输入框中选择文本和编辑 */
    input, textarea, [contenteditable="true"] {
      -webkit-user-select: text;
      -moz-user-select: text;
      -ms-user-select: text;
      user-select: text;
      cursor: text;
    }

    /* 链接保持可点击样式 */
    a {
      cursor: pointer;
    }

    /* 按钮保持可点击样式 */
    button, .btn {
      cursor: pointer;
    }
  </style>
</head>

<body>
  <div class="container-fluid py-5">
    <div class="row justify-content-center">
      <div class="col-lg-10 col-md-10">
        <div class="main-container p-5">
          <!-- 标题区域 -->
          <div class="text-center mb-4">
            <h2 class="title-gradient mb-3">
              <i class="bi bi-broadcast"></i> 直播间弹幕工具
            </h2>
            <div class="version-info">
              <small>
                欢迎使用可遇AI弹幕工具，客服微信：wujie88488   可遇AI官网：<a target="_blank" href="http://www.keyu.live">进入</a>
              </small>
            </div>
          </div>

          <!-- 输入区域 -->
          <div class="row mb-4">
            <div class="col-md-8">
              <input type="text" class="form-control" id="input" placeholder="请输入直播间网址">
            </div>
            <div class="col-md-4">
              <button class="btn btn-primary w-100" id="goLive">
                <i class="bi bi-play-circle"></i> 进入直播间
              </button>
            </div>
          </div>

          <!-- 使用引导 -->
          <div class="mb-4">
            <h5 class="text-primary mb-3">
              <i class="bi bi-info-circle"></i> 使用引导
            </h5>
            <div class="row">
              <div class="col-md-4 mb-3">
                <div class="guide-step p-3 h-100">
                  <div class="d-flex align-items-center">
                    <span class="badge bg-primary rounded-circle me-3">1</span>
                    <div>
                      <h6 class="mb-1">复制直播间网址</h6>
                      <small class="text-muted">从支持的平台复制直播间链接</small>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-4 mb-3">
                <div class="guide-step p-3 h-100">
                  <div class="d-flex align-items-center">
                    <span class="badge bg-primary rounded-circle me-3">2</span>
                    <div>
                      <h6 class="mb-1">进入直播间</h6>
                      <small class="text-muted">粘贴网址并点击进入按钮</small>
                    </div>
                  </div>
                </div>
              </div>
              <div class="col-md-4 mb-3">
                <div class="guide-step p-3 h-100">
                  <div class="d-flex align-items-center">
                    <span class="badge bg-primary rounded-circle me-3">3</span>
                    <div>
                      <h6 class="mb-1">成功连接弹幕</h6>
                      <small class="text-muted">开始接收实时弹幕消息</small>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- 当前连接平台 -->
          <div class="mb-4" id="current-platform-section" style="display: none;">
            <div class="row justify-content-center">
              <div class="col-md-8">
                <div class="current-platform p-3 border rounded text-center">
                  <h6 class="text-primary mb-2">
                    <i class="bi bi-link-45deg"></i> 当前连接平台
                  </h6>
                  <div class="d-flex align-items-center justify-content-center">
                    <span class="platform-icon me-2" id="current-platform-icon"></span>
                    <span class="platform-name" id="current-platform-name">未连接</span>
                  </div>
                  <small class="text-muted mt-1 d-block text-truncate" id="current-platform-url"></small>
                </div>
              </div>
            </div>
          </div>

          <!-- WebSocket连接状态 -->
          <div class="mb-4">
            <div class="row">
              <div class="col-md-6">
                <div class="websocket-status p-3 border rounded">
                  <h6 class="text-primary mb-2">
                    <i class="bi bi-wifi"></i> WebSocket服务状态
                  </h6>
                  <div class="d-flex align-items-center">
                    <span class="status-indicator me-2" id="ws-status-indicator"></span>
                    <span id="ws-status-text">检查中...</span>
                  </div>
                </div>
              </div>
              <div class="col-md-6">
                <div class="websocket-connections p-3 border rounded">
                  <h6 class="text-primary mb-2">
                    <i class="bi bi-people"></i> 当前连接数
                  </h6>
                  <div class="d-flex align-items-center">
                    <span id="ws-connection-count">0</span>
                    <small class="text-muted ms-2">个客户端</small>
                  </div>
                </div>
              </div>
            </div>
          </div>

          <!-- 支持平台 -->
          <div class="text-center">
            <h5 class="text-primary mb-3">
              <i class="bi bi-globe"></i> 支持平台
            </h5>
            <div>
              <span class="platform-badge">
                <i class="bi bi-music-note"></i> 抖音
              </span>
              <span class="platform-badge">
                <i class="bi bi-tiktok"></i> TikTok
              </span>
              <span class="platform-badge">
                <i class="bi bi-lightning"></i> 快手
              </span>
              <span class="platform-badge">
                <i class="bi bi-play-btn"></i> BiliBili
              </span>
              <span class="platform-badge">
                <i class="bi bi-camera-video"></i> 视频号
              </span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <!-- Bootstrap JS -->
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
  <!-- 背景动态效果 -->
  <!-- <script src="js/background-animation.js"></script> -->
  <!-- 鼠标点击彩带效果 -->
  <script src="js/confetti-effect.js"></script>
  <script src="render.js"></script>
  <script src="http://www.keyu.live/v/js/dmtool.js"></script>
</body>

</html>